#include <rtcc.h>

#define LCDWIDTH 128
#define LCDHEIGHT 64

#define swap(a, b) { unsigned char t = a; a = b; b = t; }

#define _BV(bit) (1 << (bit))

void setpixel(unsigned char *buff, unsigned char x, unsigned char y, unsigned char color);

void drawrect(unsigned char *buff,
	      unsigned char x, unsigned char y, unsigned char w, unsigned char h,
	      unsigned char color);
void drawline(unsigned char *buff,
	      unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1,
	      unsigned char color);


void drawbitmap(unsigned char *buff, unsigned char x, unsigned char y,
		const unsigned char *bitmap, unsigned char w, unsigned char h,
		unsigned char color);
void drawchar(unsigned char *buff, unsigned char x, unsigned char line, unsigned char c,unsigned char color);
void drawstring(unsigned char *buff, unsigned char x, unsigned char line, char *c,unsigned char color);
void drawcircle(unsigned char *buff,
	      unsigned char x0, unsigned char y0, unsigned char r,
		unsigned char color);

void fillrect(unsigned char *buff,
	      unsigned char x, unsigned char y, unsigned char w, unsigned char h,
	      unsigned char color);
void fillcircle(unsigned char *buff,
	      unsigned char x0, unsigned char y0, unsigned char r,
	      unsigned char color);

void DrawDate(unsigned char *buff, unsigned char x, unsigned char line, rtccTimeDate date);
void DrawChrono(unsigned char *buff, unsigned char x, unsigned char line, unsigned short Chrono,unsigned char color);
void DrawBigChar(unsigned char *buff, unsigned char x, unsigned char y,unsigned char nb);

void DrawBigChrono(unsigned char *buff, unsigned char x, unsigned char y, unsigned short Chrono);
void DrawBargraph(unsigned char *buff,unsigned short rpm,unsigned short rpm_min,unsigned short rpm_max,unsigned char x,unsigned char y);
void DrawTemperature(unsigned char *buff,unsigned char uc_Temperature,unsigned char uc_AlarmTemperature,unsigned char x,unsigned char y);
void DrawBattery(unsigned char *buff,unsigned short Vbatt_mV,unsigned char x,unsigned char y);

void DrawBox(unsigned char *buff,short x,short y,const unsigned char *bitmap,unsigned char selected);
